import { createApp } from "vue";
import { createPinia } from "pinia";
import { VueQueryPlugin } from "@tanstack/vue-query";
import App from "./App.vue";
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
import "./index.css";

const app = createApp(App);

// 创建 Pinia 实例
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);

// 配置 Vue Query
app.use(VueQueryPlugin, {
  queryClientConfig: {
    defaultOptions: {
      queries: {
        retry: 1,
        refetchOnWindowFocus: false,
        staleTime: 5 * 60 * 1000 // 5分钟
      },
      mutations: {
        retry: 1
      }
    }
  }
});

// 使用 Pinia
app.use(pinia);

app.mount("#app");
